<div class="row">
  <div class="col-xs-12">
    <table id="grade-list" class="table table-hover table-striped table-bordered">
      <thead>
      <tr>
        <th class="center" style="width:90px;">分类</th>
        <th class="center" style="width:130px;">{!!$plan->present()->categoryTitle!!}名称</th>
        <th class="center" style="width:70px;">招收</th>
        <th class="center" style="width:70px;">报名</th>
        <th class="center" style="width:70px;">限招</th>
        <th class="center" style="width:70px;">考试</th>
        <th class="center" style="width:130px;">上课时间</th>
        <th class="center">备注</th>
      </tr>
      </thead>
      <tbody>
      @foreach ($categories as $category)
        @if( count($category->grade) > 0)
            <?php
            $count = count($category->grade);
            $rowspan = $count == 1 ? '' : "rowspan='{$count}'";
            $grade = $category->grade->shift();
            ?>
            <tr>
              <td class="center" {!! $rowspan !!}>{{$category->name}}</td>
              <td class="align-middle"><a
                    href="{{route('education.grade.edit', array($method,$grade->id))}}">{{ $grade->name }}</a></td>
              <td class="center b-borrow">{{ $grade->number }}</td>
              <td class="center b-return"><a href="{{route('education.enrol.index', array($plan->id,$grade->id))}}"
                                             class="b-return">{{ $grade->enrols->count() }}</a></td>
              <td class="center">{!! $grade->present()->LimitedStatus !!}</td>
              <td class="center">{!! $grade->present()->ExamStatus !!}</td>
              <td class="align-middle center">
                {{ date('Y-m-d',$grade->study_date) }}<br/>
                {{ date('H:i',strtotime($grade->grade_begin)) }}-{{ date('H:i',strtotime($grade->grade_end)) }}
              </td>
              <td class="align-middle"><span class="desc">{{ $grade->desc }}</span></td>
            </tr>

            @if($rowspan != '')
              @foreach($category->grade as $grade)
                <tr>
                  <td class="align-middle"><a
                        href="{{route('education.grade.edit', array($method,$grade->id))}}">{{ $grade->name }}</a></td>
                  <td class="center b-borrow">{{ $grade->number }}</td>
                  <td class="center b-return"><a
                        href="{{route('education.enrol.index', array('pid'=>$plan->id,'cid'=>$grade->id))}}"
                        class="b-return">{{ $grade->enrols->count() }}</a></td>
                  <td class="center">{!! $grade->present()->LimitedStatus !!}</td>
                  <td class="center">{!! $grade->present()->ExamStatus !!}</td>
                  <td class="align-middle center">
                    {{ date('Y-m-d',$grade->study_date) }}<br/>
                    {{ date('H:i',strtotime($grade->grade_begin)) }}-{{ date('H:i',strtotime($grade->grade_end)) }}
                  </td>
                  <td class="align-middle"><span class="desc">{{ $grade->desc }}</span></td>
                </tr>
              @endforeach
            @endif
        @endif
      @endforeach
      </tbody>
    </table>
  </div>
</div><!-- /.row -->